//
//  TemplateView.h
//  ResourceLoader
//
//  Created by winston on 13-4-10.
//  Copyright (c) 2013年 winston. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ResourceLoader.h"

#define  TemplateWidth                  225
#define  TemplateHeight                 195
#define  TemplateSpaceX                 30
#define  TemplateSpaceY                 20
#define  TemplateTopSpace               50

#define  TemplateWidthMiddle            676
#define  TemplateHeightMiddle           623-30

//#define  TemplateImageBGWidthMiddle     612
//#define  TemplateImageBGHeightMiddle    390
//#define  TemplateImageBGWidth           306
//#define  TemplateImageBGHeight          195

#define  YCenterOffset                  50

typedef enum
{
    ImageTemplateType   = 0x01,
    VidelTemplateType   = 0x02,
    MixTemplateType     = 0x03,
}TemplateType;

@class TemplateView;
@protocol TemplateViewDelegate

@required
-(void)ViewBeTouch:(TemplateView *)view;
@end

@interface TemplateView : UIView
{
    NSString * smallImageName;
    NSString * middleImageName;
    NSString * bigImageName;
    NSString * textString;
    NSString * contentString;
    NSString * videoName;
    
//    NSString * autoID;
//    NSString * moduleKey;
    NSString * rootPath;
    NSString * playPath;
    
    UIImageView * backimageViewSmall;
    UIImageView * backimageViewMiddle;
    
    TemplateType type;
    
    id<TemplateViewDelegate> delegate;
}

@property(nonatomic,retain)NSString * smallImageName;
@property(nonatomic,retain)NSString * middleImageName;
@property(nonatomic,retain)NSString * bigImageName;
@property(nonatomic,retain)NSString * textString;
@property(nonatomic,retain)NSString * contentString;
@property(nonatomic,retain)NSString * videoName;
@property(nonatomic,retain)NSString * playPath;

@property(nonatomic,assign)id<TemplateViewDelegate> delegate;
@property(nonatomic,assign)TemplateType type;

//@property(nonatomic,retain)NSString * autoID;
//@property(nonatomic,retain)NSString * moduleKey;
@property(nonatomic,retain)NSString * rootPath;

-(id)initWithTemplate:(NSDictionary*)data;
-(void)renderTemplate;
-(void)TransmutationSmall;
-(void)TransmutationMiddle;
-(CGFloat)caculateTitleHeight:(NSString*)title FontSize:(int)size Width:(int)width;
@end
